package com.gis.visualization.controller.fileoss;

import com.gis.visualization.config.result.R;
import com.gis.visualization.service.OssService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/gis/fileoss")
@CrossOrigin
@Api("图片上传")
public class FileOssController {
    @Autowired
    private OssService ossService;
    //    上传头像的方法
//    MultipartFile 此对象能获取上传的文件
    @PostMapping
    public R uploadOssFile(MultipartFile file){
        String url  = ossService.uploadFileImg(file);
        return R.ok().data("url",url).message("图片上传成功");
    }
}
